package com.wumeng.interview;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import android.os.Bundle;
import android.view.View;

import com.wumeng.interview.databinding.ActivityMainBinding;
import com.wumeng.interview.helper.IntentHelper;
import com.wumeng.interview.view.DoubleRecyclerActivity;
import com.wumeng.interview.view.MediaPlayerActivity;
import com.wumeng.interview.view.SnackBarActivity;
import com.wumeng.interview.view.SwitchLanguageActivity;

/**
  * @Time : 2021/8/2
  * @Author : Wu-Meng
  * @Description :
 */
public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private ActivityMainBinding mainBinding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mainBinding = DataBindingUtil.setContentView(this,R.layout.activity_main);
        initClick();
    }

    /**
     * 点击事件
     */
    private void initClick() {
        mainBinding.btnSnackBar.setOnClickListener(this);
        mainBinding.btnMediaPlayer.setOnClickListener(this);
        mainBinding.btnSwitchLanguage.setOnClickListener(this);
        mainBinding.btnRecyclerView.setOnClickListener(this);
    }

    /**
     * 点击事件
     * @param view
     */
    @Override
    public void onClick(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.btn_snackBar:
                IntentHelper.startActivity(this, SnackBarActivity.class);
                break;
            case R.id.btn_mediaPlayer:
                IntentHelper.startActivity(this, MediaPlayerActivity.class);
                break;
            case R.id.btn_switch_language:
                IntentHelper.startActivity(this, SwitchLanguageActivity.class);
                break;
            case R.id.btn_recycler_view:
                IntentHelper.startActivity(this, DoubleRecyclerActivity.class);
                break;
            default:
                break;
        }
    }

}